<?php
/*
 * Load all used classes automatically.
 */
function __autoload($class) {
	$class = strtolower($class);
	if(preg_match("/mysql/", $class)){
		require_once ("../class/MySQL/" . $class . ".class.php");
		return;
	}
	if(preg_match("/log/", $class) && !preg_match("/login/", $class)){
		require_once ("../class/log/" . $class . ".class.php");
		return;			
	}
	if(preg_match("/user/", $class)){
		require_once ("../class/user/" . $class . ".class.php");
		return;			
	}
	if(preg_match("/site/", $class)){
		require_once ("../class/site/" . $class . ".class.php");
		return;			
	}
	require_once ("../class/" . $class . ".class.php");
}

/*
 * Reads the GET-Variable "page". Includes a file depending of the content of the GET-Variable.
 */
function include_file() {
	if (isset($_GET["page"])) {
		$filename = "inc/" . $_GET["page"] . ".inc.php";
		if (file_exists($filename)) {
			include ($filename);
		} else {
			include ("inc/allgemein.inc.php");
		}
	} else {
		include ("inc/allgemein.inc.php");
	}
}
?>